package Managers;

import java.awt.Color;

public class Category implements Comparable<Category>
{

	private String name;
	private Color color;

	public Category(String cName, Color c)
	{
		this.name = cName;
		this.color = c;
	}
	
	
	@Override
	public int compareTo(Category c)
	{

		if(!name.equalsIgnoreCase(c.name))
		{
			return -1;
		}
		else if(!color.equals(c.color))
		{
			return -1;
		}
		else
		{
			return 0;
		}

	}
	
	public String toString()
	{
		return String.format("%s -- %s", name, color.toString());
	}
	
	@Override
	public boolean equals(Object o)
	{
		if(o == null)
			return false;
		else if(o == this)
			return true;
		else if(o.getClass() != this.getClass())
			return false;
		
		Category c = (Category)o;
		
		if(c.getName().equalsIgnoreCase(this.name)
				&& c.getColor().equals(this.color))
			return true;
		else
			return false;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Color getColor() {
		return color;
	}

	public void setColor(Color color) {
		this.color = color;
	}

	public static Category None()
	{
		return new Category("None", Color.white);
	}
	public static Category Blue()
	{
		return new Category("Blue", Color.BLUE);
	}
	public static Category Red()
	{
		return new Category("Red", Color.RED);
	}
	
}
